<template>
  <view class="container">
    <!-- 标题 -->
    <view class="header">
      <img src="/static/投标信息.svg" />
      <text class="title">投标信息</text>
    </view>

    <!-- 投标信息 -->
    <view class="content">
      <!-- 投标单资格号 -->
      <view class="info-item">
        <text class="label">投标单据编号</text>
        <text class="value">{{ detailData.biddingCode }}</text>
      </view>

      <!-- 项目名称 -->
      <view class="info-item">
        <text class="label">项目名称</text>
        <text class="value">{{ detailData.projectName }}</text>
      </view>

      <!-- 项目区域 -->
      <view class="info-item">
        <text class="label">项目区域</text>
        <text class="value">{{ detailData.projectArea }}</text>
      </view>

      <!-- 是否SM -->
      <view class="info-item">
        <text class="label">是否SM</text>
        <text class="value">{{ detailData.isSm }}</text>
      </view>

      <!-- 是否重大项目 -->
      <view class="info-item">
        <text class="label">是否重大项目</text>
        <text class="value">{{ detailData.isSignificantProject }}</text>
      </view>

      <view v-if="isExpand">
        <!-- 专业类型 -->
        <view class="info-item">
          <text class="label">专业类型</text>
          <text class="value">{{ detailData.professionalType }}</text>
        </view>

        <!-- 客户名称 -->
        <view class="info-item">
          <text class="label">客户名称</text>
          <text class="value">{{ detailData.biddingUnitIdList }}</text>
        </view>

        <!-- 客户类型 -->
        <view class="info-item">
          <text class="label">客户类型</text>
          <text class="value">{{ detailData.customerType }}</text>
        </view>

        <!-- 业务类型 -->
        <view class="info-item">
          <text class="label">业务类型</text>
          <text class="value">{{ detailData.newBusinessType }}</text>
        </view>

        <!-- I级赛道标签 -->
        <view class="info-item">
          <text class="label">I级赛道标签</text>
          <text class="value">{{ detailData.firstTrackLabel }}</text>
        </view>

        <!-- II级赛道标签 -->
        <view class="info-item">
          <text class="label">II级赛道标签</text>
          <text class="value">{{ detailData.secondTrackLabel }}</text>
        </view>

        <!-- 营销经理 -->
        <view class="info-item">
          <text class="label">营销经理</text>
          <text class="value">{{ detailData.marketingManager }}</text>
        </view>

        <!-- 营销经理所在部门 -->
        <view class="info-item">
          <text class="label">营销经理所在部门</text>
          <text class="value">{{ detailData.marketingManagerDept }}</text>
        </view>

        <!-- 项目概述 -->
        <view class="info-item">
          <text class="label">项目概述</text>
          <text class="value">{{ detailData.projectDescription }}</text>
        </view>

        <!-- 招标方式 -->
        <view class="info-item">
          <text class="label">招标方式</text>
          <text class="value">{{ detailData.biddingMethod }}</text>
        </view>

        <!-- 发标时间 -->
        <view class="info-item">
          <text class="label">发标时间</text>
          <text class="value">{{ detailData.tenderingTime }}</text>
        </view>

        <!-- 截标时间 -->
        <view class="info-item">
          <text class="label">截标时间</text>
          <text class="value">{{ detailData.closeTenderingTime }}</text>
        </view>

        <!-- 标的金额 -->
        <view class="info-item">
          <text class="label">标的金额（万元）</text>
          <text class="value">{{ detailData.biddingAmount }}</text>
        </view>

        <!-- 预计收入 -->
        <view class="info-item">
          <text class="label">预计收入（万元）</text>
          <text class="value">{{ detailData.estimateRevenue }}</text>
        </view>

        <!-- 预计毛利率 -->
        <view class="info-item">
          <text class="label">预计毛利率</text>
          <text class="value">{{ detailData.estimateGrossMarginRate }}</text>
        </view>

        <!-- 投标文件关键条款 -->
        <view class="info-item">
          <text class="label">投标文件关键条款</text>
          <text class="value">{{ detailData.keyTermsOfTenderDocuments }}</text>
        </view>

        <!-- 用章类别 -->
        <view class="info-item">
          <text class="label">用章类别</text>
          <text class="value">{{ detailData.sealType }}</text>
        </view>

        <!-- 是否需要提交标书费 -->
        <view class="info-item">
          <text class="label">是否需要提交标书费</text>
          <text class="value">{{ detailData.isNeedTenderFee ? '是' : '否' }}</text>
        </view>

        <!-- 标书费金额 -->
        <view class="info-item">
          <text class="label">标书费金额（元）</text>
          <text class="value">{{ detailData.tenderFeeAmount }}</text>
        </view>

        <!-- 是否需要递交保证金 -->
        <view class="info-item">
          <text class="label">是否需要递交保证金</text>
          <text class="value">{{ detailData.isNeedDeposit ? '是' : '否' }}</text>
        </view>

        <!-- 保证金金额 -->
        <view class="info-item">
          <text class="label">保证金金额（元）</text>
          <text class="value">{{ detailData.depositAmount }}</text>
        </view>
      </view>

      <view class="feature-box" v-if="isExpand" @click="toggleExpand">
        <text class="label">收起展示</text>
        <img src="/static/收起.svg" />
      </view>
      <view class="feature-box" v-else @click="toggleExpand">
        <text class="label">全部展开</text>
        <img src="/static/展开.svg" />
      </view>
    </view>

    <!-- 投标报价信息 -->
    <view class="header">
      <img src="/static/报价信息.svg" />
      <text class="title">投标报价信息</text>
    </view>
    <view class="content">
      <!-- 报价方式 -->
      <view class="info-item">
        <text class="label">报价方式</text>
        <text class="value">{{ detailData.quotationMethod }}</text>
      </view>

      <!-- 投标报价 -->
      <view class="info-item">
        <text class="label">投标报价（元）</text>
        <text class="value">{{ detailData.quoteAmount }}</text>
      </view>

      <!-- 报价折扣 -->
      <view class="info-item">
        <text class="label">报价折扣</text>
        <text class="value">{{ detailData.quoteDiscount }}</text>
      </view>

      <!-- 下浮差 -->
      <view class="info-item">
        <text class="label">下浮差</text>
        <text class="value">{{ detailData.quoteDiscountRate }}</text>
      </view>

      <!-- 报价备注 -->
      <view class="info-item">
        <text class="label">报价备注</text>
        <text class="value">{{ detailData.priceRemarks }}</text>
      </view>
    </view>

    <!-- 附件 -->
    <view class="header">
      <img src="/static/投标信息.svg" />
      <text class="title">附件</text>
    </view>
    <view class="content">
      <!-- 招标文件 -->
      <view class="info-item">
        <text class="label">【招标文件】</text>
        <text class="value">{{ bidDocument }}</text>
      </view>

      <!-- 补充协议 -->
      <view class="info-item">
        <text class="label">【补充协议】</text>
        <text class="value">{{ supplementaryAgreement }}</text>
      </view>
    </view>

    <!-- 审核处理模块 -->
    <view class="header">
      <img src="/static/审核处理.svg" />
      <text class="title">审核处理</text>
    </view>
    <view class="audit-section">
      <!-- 当前审核环节 -->
      <view class="info-item">
        <text class="label">当前审核环节</text>
        <text class="value">{{ currentApprovalStep }}</text>
      </view>

      <!-- 当前环节审核结果 -->
      <view class="info-item">
        <text class="label">当前环节审核结果</text>
        <radio-group v-model="approvalResult">
          <radio style="transform:scale(0.8)" value="1" :checked="approvalResult === '1'">审核通过</radio>
          <radio style="transform:scale(0.8)" value="0" :checked="approvalResult === '0'">审核不通过</radio>
        </radio-group>
      </view>

      <!-- 处理意见 -->
      <view class="info-item" style="display: block;">
        <text class="label">处理意见</text>
        <view>
          <textarea
            maxlength="200"
            style="background-color: #EDF6FF;padding: 10px;border-radius:10px;margin-top:10px;height:80px"
            v-model="processingOpinion"
            placeholder="请输入你的处理意见"
          />
        </view>
      </view>

      <!-- 下个审核环节 -->
      <view class="info-item">
        <text class="label">下个审核环节</text>
        <text class="value">{{ nextApprovalStep }}</text>
      </view>

      <!-- 下个环节处理人 -->
      <view class="info-item">
        <text class="label">下个环节处理人</text>
        <text class="value">{{ nextApprovalPerson }}</text>
      </view>
    </view>

    <!-- 底部按钮 -->
    <view class="footer">
      <view @click="cancel" class="footer-item-left">
        <text>取消</text>
      </view>
      <view class="footer-item-right">
        <img src="/static/打勾.svg" />
        <text>确定</text>
      </view>
    </view>
  </view>
</template>

<script>
  import { getBidListDetail } from '@/api/todo'

export default {
  data() {
    return {
      detailData:{},
      isExpand:false,
      bidQualificationCode: '2024122912090900',
      projectName: '湖南普教育厅关于采购招标代理服务的网上超市采购项目成交公告',
      projectArea: '中国-北京市-市辖区-石泉山区',
      isSM: 'MG1',
      isMajorProject: '贸易业务：信用交易金额≥3500万元（对方为中证富商索亚客户）',
      professionalType: '供应链服务-招标服务-造价咨询',
      clientName: '中国电信',
      clientType: '中国电信',
      businessType: '新客户新业务',
      firstLevelTag: '双碳',
      secondLevelTag: '老旧机梯改造、基站节能、绿色新能源、新能源电动车',
      marketingManager: '李四',
      marketingDepartment: '市场部',
      projectOverview: '湖南普教育厅关于采购招标代理服务的网上超市采购项目成交公告内容信息',
      biddingMethod: '招标',
      bidStartTime: '2025-1-12',
      bidEndTime: '2025-1-20',
      bidAmount: '5000',
      expectedRevenue: '4500',
      grossMargin: '26%',
      bidKeyTerms: '国产化信创经验：有同类型项目金额5000万以上',
      usageCategory: '无需盖章',
      isBidFeeRequired: true,
      bidFeeAmount: '20',
      isBidBondRequired: true,
      bidBondAmount: '1000',
      bidPriceMethod: '金额',
      bidPrice: '48900000.00',
      bidDiscount: '97.6%',
      bidPriceDifference: '-2.2%',
      bidPriceRemark: '我司有相关成功案例，几率比较大',
      bidDocument: '项目AA招标方案.pdf',
      supplementaryAgreement: '项目AAA补充协议.doc',
      currentApprovalStep: '业务单位内部审批',
      approvalResult: '0',
      processingOpinion: '',
      nextApprovalStep: '市场主管审批会签',
      nextApprovalPerson: '周杭欢, 刘星'
    };
  },
  mounted(){
    this.getDetail()
  },
  methods: {
    getDetail(){
      getBidListDetail({
        id:this.$route.query.id
      }).then(res=>{
        this.detailData = res.data
      })
    },
    cancel() {
      uni.navigateBack();
    },
    toggleExpand(){
      this.isExpand = !this.isExpand;
    }
  }
};
</script>

<style lang="scss" scoped>
/* 页面容器 */
.container {
  padding: 20px;
  background-color: #EDF6FF;
  min-height: 100vh;
  position: relative;
  padding-bottom: 90px;
}

/* 标题 */
.header {
  margin-bottom: 20px;
  img {
    vertical-align: middle;
    margin-right: 10px;
  }
}

.title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

/* 内容区域 */
.content {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  padding-bottom: 0;
}

/* 信息项 */
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.info-item:last-child {
  border-bottom: none;
}

/* 标签 */
.label {
  font-size: 14px;
  color: #889cac;
}

/* 值 */
.value {
  font-size: 14px;
  color: #333;
  text-align: right;
  max-width: 60%;
}

/* 审核处理模块 */
.audit-section {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
}

/* 底部按钮 */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 0 20px;

  .footer-item-left {
    flex: 1;
    text-align: center;
    line-height: 40px;
    background-color: #fff;
    background: #f4f6fa;
    border: 1px solid rgba(36, 102, 239, 0.71);
    border-radius: 4px;
    color: #2466EF;
    box-sizing: border-box;
  }

  .footer-item-right {
    flex: 3;
    text-align: center;
    line-height: 40px;
    background: linear-gradient(270deg, #689bff, #1257ea);
    border-radius: 4px;
    color: #fff;
    img {
      vertical-align: -3px;
      margin-right: 5px;
    }
  }
}
.feature-box{
  height:48px;
  line-height: 48px;
  text-align: center;
  img{
    vertical-align: middle;
  }
}
</style>